﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="AquariumDetail.aspx.vb" Inherits="FishTank.AquariumDetail" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        <asp:ScriptManager ID="AquariumDetailScriptManager" runat="server"></asp:ScriptManager>
        <asp:FormView ID="DetailFormView" runat="server" width="100%" CssClass="detailView">
            <EditItemTemplate>
            <h1>Edit your aquarium</h1>

                <span class="failureNotification">
                    <asp:Literal ID="FailureText" runat="server"></asp:Literal>
                </span>
                <asp:ValidationSummary ID="AquariumValidationSummary" runat="server" CssClass="failureNotification" 
                     ValidationGroup="AquariumValidationGroup"/>

                <div class="itemInfo">
                <fieldset class="item">
                    <legend>Aquarium Information</legend>
                    <p>
                        <asp:Label ID="TitleLabel" runat="server" AssociatedControlID="TitleTextBox">Title:</asp:Label>
                        <asp:TextBox ID="TitleTextBox" runat="server" CssClass="textEntry" Text='<%# Bind("Title") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="TitleRequiredValidator" runat="server" ControlToValidate="TitleTextBox" 
                             CssClass="failureNotification" ErrorMessage="Title is required." ToolTip="Title is required." 
                             ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>
                    </p>
                    <p>
                        <asp:Label ID="DescriptionLabel" runat="server" AssociatedControlID="DescriptionTextBox">Description:</asp:Label>
                        <asp:TextBox ID="DescriptionTextBox" runat="server" CssClass="textEntry" TextMode="MultiLine" Text='<%# Bind("Description") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="DescriptionRequiredValidator" runat="server" ControlToValidate="DescriptionTextBox" 
                             CssClass="failureNotification" ErrorMessage="Description is required." ToolTip="Description is required." 
                             ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>
                    </p>
                    <p>
                        <asp:Label ID="AquariumTypeLabel" runat="server" AssociatedControlID="AquariumTypeList">Type:</asp:Label>
                        <asp:DropDownList ID="AquariumTypeList" runat="server" SelectedValue='<%# Bind("AquariumType") %>'>
                            <asp:ListItem Value="Freshwater">Freshwater</asp:ListItem>
                            <asp:ListItem Value="Tropical marine">Tropical marine</asp:ListItem>
                            <asp:ListItem Value="Coldwater marine">Coldwater marine</asp:ListItem>
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="AquariumTypeRequired" runat="server" ControlToValidate="AquariumTypeList" 
                             CssClass="failureNotification" ErrorMessage="Aquarium type is required." ToolTip="Aquarium type is required." 
                             ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>
                    </p>
                    <p>
                        <asp:Label ID="WaterTempLabel" runat="server" AssociatedControlID="WaterTempTextBox">Water Temperature:</asp:Label>
                        <asp:TextBox ID="WaterTempTextBox" runat="server" Width="32" Text='<%# Bind("Temperature") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="WaterTempRequiredValidator" runat="server" ControlToValidate="WaterTempTextBox" 
                            CssClass="failureNotification" ErrorMessage="Water Temperature is required." ToolTip="Water Temperature is required." 
                            ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>°C
                        <asp:RangeValidator ID="WaterTempRangeValidator" runat="server" ControlToValidate="WaterTempTextBox" 
                            ErrorMessage="Water Temperature minimum value is 16°C and maximum is 36°C"
                            MinimumValue="16" MaximumValue="36" Type="Double"
                            Display="None" ValidationGroup="AquariumValidationGroup"></asp:RangeValidator>
                        <asp:CompareValidator ID="WaterTempCompareValidator" runat="server" 
                            ControlToValidate="WaterTempTextBox" Display="None"
                            ErrorMessage="Water Temperature is not an number"
                            Operator="DataTypeCheck" Type="Double"
                            ValidationGroup="AquariumValidationGroup"></asp:CompareValidator>
                    </p>
                    <p>
                        <asp:Label ID="ProductLabel" runat="server" AssociatedControlID="ProductList">Product:</asp:Label>
                        <asp:DropDownList ID="ProductList" runat="server"
                            DataTextField="Title" DataValueField="ID"></asp:DropDownList>
                        <asp:RequiredFieldValidator ID="ProductRequiredValidator" runat="server" ControlToValidate="ProductList" 
                             CssClass="failureNotification" ErrorMessage="Product is required." ToolTip="Product is required." 
                             ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>
                    </p>
                    <p>
                        <asp:Label ID="LastCleanedLabel" runat="server" AssociatedControlID="LastCleanedTextBox">Last Cleaned Date (dd/mm/yyyy):</asp:Label>
                        <asp:TextBox ID="LastCleanedTextBox" runat="server" Text='<%# Bind("LastCleanedDateTime", "{0:dd/MM/yyyy}") %>'/>
                        <asp:CalendarExtender ID="LastCleanedTextBox_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                            Enabled="True" TargetControlID="LastCleanedTextBox"></asp:CalendarExtender>
                        <asp:RequiredFieldValidator ID="LastCleanedRequiredValidator" runat="server" ControlToValidate="LastCleanedTextBox" 
                            CssClass="failureNotification" ErrorMessage="Last cleaned date is required." ToolTip="Last cleaned date is required." 
                            ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>
                    </p>
                    <p>
                        <asp:Label ID="CleanPeriodLabel" runat="server" AssociatedControlID="CleanPeriodTextBox">Cleaning Period (days):</asp:Label>
                        <asp:TextBox ID="CleanPeriodTextBox" runat="server" Width="32" Text='<%# Bind("PeriodDaysCleaning") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="CleanPeriodRequiredValidator" runat="server" ControlToValidate="CleanPeriodTextBox" 
                            CssClass="failureNotification" ErrorMessage="Cleaning period is required." ToolTip="Cleaning period is required." 
                            ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>days
                        <asp:RangeValidator ID="CleanPeriodRangeValidator" runat="server" ControlToValidate="CleanPeriodTextBox" 
                            ErrorMessage="Cleaning period minimum value is 1 and maximum is 365."
                            MinimumValue="1" MaximumValue="365" Type="Integer"
                            Display="None" ValidationGroup="AquariumValidationGroup"></asp:RangeValidator>
                        <asp:CompareValidator ID="CleanPeriodCompareValidator" runat="server" 
                            ControlToValidate="CleanPeriodTextBox" Display="None"
                            ErrorMessage="Cleaning period is not a number in days"
                            Operator="DataTypeCheck" Type="Integer"
                            ValidationGroup="AquariumValidationGroup"></asp:CompareValidator>
                    </p>
                    <p>
                        <asp:Label ID="TagLabel" runat="server" AssociatedControlID="TagTextBox">Tags (comma separated list):</asp:Label>
                        <asp:TextBox ID="TagTextBox" runat="server" CssClass="textEntry" Text='<%# GetAquariumTagsCSV(Eval("ID")) %>'></asp:TextBox>
                    </p>
                    <p>
                        <asp:Label ID="PhotoLabel" runat="server" AssociatedControlID="PhotoFileUpload">Upload a Photo:</asp:Label>
                        <asp:FileUpload ID="PhotoFileUpload" runat="server" CssClass="fileUpload" />
                        <asp:RegularExpressionValidator ID="FileExtValidator" runat="server"
                            ValidationExpression="(.*\.([gG][iI][fF]|[jJ][pP][gG]|[jJ][pP][eE][gG]|[pP][nN][gG])$)"  
                            ControlToValidate="PhotoFileUpload" ErrorMessage="Only jpg/gif/png photos are supported."
                            ValidationGroup="AquariumValidationGroup" Display="None"></asp:RegularExpressionValidator>
                    </p>
                    <p>
                        <asp:Label ID="CurrentPhotoLabel" runat="server" AssociatedControlID="PhotoFileUpload">Current Photo:</asp:Label>
                        <asp:Image ID="PhotoImage" runat="server"
                               ImageUrl='<%# GetPhotoNormalPath(CULng(Eval("PhotoID"))) %>'
                               AlternateText="<%# Bind('Title') %>"
                               CssClass="centered" />
                    </p>
                </fieldset>
                <p class="submitButton">
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" 
                        ValidationGroup="AquariumValidationGroup" CausesValidation="False"
                        onclick="CancelEditButton_Click"/>
                    <asp:Button ID="SaveButton" runat="server" CommandName="Save" Text="Save" 
                        ValidationGroup="AquariumValidationGroup" onclick="SaveButton_Click"/>
                </p>
                </div>
                    
            </EditItemTemplate>
            <InsertItemTemplate>
                <h1>Add your aquarium</h1>

                <span class="failureNotification">
                    <asp:Literal ID="FailureText" runat="server"></asp:Literal>
                </span>
                <asp:ValidationSummary ID="AquariumValidationSummary" runat="server" CssClass="failureNotification" 
                     ValidationGroup="AquariumValidationGroup"/>

                <div class="itemInfo">
                <fieldset class="item">
                    <legend>Aquarium Information</legend>
                    <p>
                        <asp:Label ID="TitleLabel" runat="server" AssociatedControlID="TitleTextBox">Title:</asp:Label>
                        <asp:TextBox ID="TitleTextBox" runat="server" CssClass="textEntry"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="TitleRequiredValidator" runat="server" ControlToValidate="TitleTextBox" 
                             CssClass="failureNotification" ErrorMessage="Title is required." ToolTip="Title is required." 
                             ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>
                    </p>
                    <p>
                        <asp:Label ID="DescriptionLabel" runat="server" AssociatedControlID="DescriptionTextBox">Description:</asp:Label>
                        <asp:TextBox ID="DescriptionTextBox" runat="server" CssClass="textEntry" TextMode="MultiLine"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="DescriptionRequiredValidator" runat="server" ControlToValidate="DescriptionTextBox" 
                             CssClass="failureNotification" ErrorMessage="Description is required." ToolTip="Description is required." 
                             ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>
                    </p>
                    <p>
                        <asp:Label ID="AquariumTypeLabel" runat="server" AssociatedControlID="AquariumTypeList">Type:</asp:Label>
                        <asp:DropDownList ID="AquariumTypeList" runat="server">
                            <asp:ListItem Value="Freshwater">Freshwater</asp:ListItem>
                            <asp:ListItem Value="Tropical marine">Tropical marine</asp:ListItem>
                            <asp:ListItem Value="Coldwater marine">Coldwater marine</asp:ListItem>
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="AquariumTypeRequired" runat="server" ControlToValidate="AquariumTypeList" 
                             CssClass="failureNotification" ErrorMessage="Aquarium type is required." ToolTip="Aquarium type is required." 
                             ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>
                    </p>
                    <p>
                        <asp:Label ID="WaterTempLabel" runat="server" AssociatedControlID="WaterTempTextBox">Water Temperature:</asp:Label>
                        <asp:TextBox ID="WaterTempTextBox" runat="server" Width="32"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="WaterTempRequiredValidator" runat="server" ControlToValidate="WaterTempTextBox" 
                            CssClass="failureNotification" ErrorMessage="Water Temperature is required." ToolTip="Water Temperature is required." 
                            ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>°C
                        <asp:RangeValidator ID="WaterTempRangeValidator" runat="server" ControlToValidate="WaterTempTextBox" 
                            ErrorMessage="Water Temperature minimum value is 16°C and maximum is 36°C"
                            MinimumValue="16" MaximumValue="36" Type="Double"
                            Display="None" ValidationGroup="AquariumValidationGroup"></asp:RangeValidator>
                        <asp:CompareValidator ID="WaterTempCompareValidator" runat="server" 
                            ControlToValidate="WaterTempTextBox" Display="None"
                            ErrorMessage="Water Temperature is not an number"
                            Operator="DataTypeCheck" Type="Double"
                            ValidationGroup="AquariumValidationGroup"></asp:CompareValidator>
                    </p>
                    <p>
                        <asp:Label ID="ProductLabel" runat="server" AssociatedControlID="ProductList">Product:</asp:Label>
                        <asp:DropDownList ID="ProductList" runat="server" DataTextField="Title" DataValueField="ID"></asp:DropDownList>
                        <asp:RequiredFieldValidator ID="ProductRequiredValidator" runat="server" ControlToValidate="ProductList" 
                             CssClass="failureNotification" ErrorMessage="Product is required." ToolTip="Product is required." 
                             ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>
                    </p>
                    <p>
                        <asp:Label ID="LastCleanedLabel" runat="server" AssociatedControlID="LastCleanedTextBox">Last Cleaned Date (dd/mm/yyyy):</asp:Label>
                        <asp:TextBox ID="LastCleanedTextBox" runat="server" />
                        <asp:CalendarExtender ID="LastCleanedTextBox_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                            Enabled="True" TargetControlID="LastCleanedTextBox"></asp:CalendarExtender>
                        <asp:RequiredFieldValidator ID="LastCleanedRequiredValidator" runat="server" ControlToValidate="LastCleanedTextBox" 
                            CssClass="failureNotification" ErrorMessage="Last cleaned date is required." ToolTip="Last cleaned date is required." 
                            ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>
                    </p>
                    <p>
                        <asp:Label ID="CleanPeriodLabel" runat="server" AssociatedControlID="CleanPeriodTextBox">Cleaning Period (days):</asp:Label>
                        <asp:TextBox ID="CleanPeriodTextBox" runat="server" Width="32"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="CleanPeriodRequiredValidator" runat="server" ControlToValidate="CleanPeriodTextBox" 
                            CssClass="failureNotification" ErrorMessage="Cleaning period is required." ToolTip="Cleaning period is required." 
                            ValidationGroup="AquariumValidationGroup">*</asp:RequiredFieldValidator>days
                        <asp:RangeValidator ID="CleanPeriodRangeValidator" runat="server" ControlToValidate="CleanPeriodTextBox" 
                            ErrorMessage="Cleaning period minimum value is 1 and maximum is 365."
                            MinimumValue="1" MaximumValue="365" Type="Integer"
                            Display="None" ValidationGroup="AquariumValidationGroup"></asp:RangeValidator>
                        <asp:CompareValidator ID="CleanPeriodCompareValidator" runat="server" 
                            ControlToValidate="CleanPeriodTextBox" Display="None"
                            ErrorMessage="Cleaning period is not a number in days"
                            Operator="DataTypeCheck" Type="Integer"
                            ValidationGroup="AquariumValidationGroup"></asp:CompareValidator>
                    </p>
                    <p>
                        <asp:Label ID="TagLabel" runat="server" AssociatedControlID="TagTextBox">Tags (comma separated list):</asp:Label>
                        <asp:TextBox ID="TagTextBox" runat="server" CssClass="textEntry"></asp:TextBox>
                    </p>
                    <p>
                        <asp:Label ID="PhotoLabel" runat="server" AssociatedControlID="PhotoFileUpload">Upload a Photo:</asp:Label>
                        <asp:FileUpload ID="PhotoFileUpload" runat="server" CssClass="fileUpload" />
                        <asp:RegularExpressionValidator ID="FileExtValidator" runat="server"
                            ValidationExpression="(.*\.([gG][iI][fF]|[jJ][pP][gG]|[jJ][pP][eE][gG]|[pP][nN][gG])$)"  
                            ControlToValidate="PhotoFileUpload" ErrorMessage="Only jpg/gif/png photos are supported."
                            ValidationGroup="AquariumValidationGroup" Display="None"></asp:RegularExpressionValidator>
                    </p>
                </fieldset>
                <p class="submitButton">
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" 
                        ValidationGroup="AquariumValidationGroup" CausesValidation="False"
                        PostBackUrl="~/Pages/AquariumList.aspx" />
                    <asp:Button ID="SubmitButton" runat="server" CommandName="Submit" Text="Submit" 
                        ValidationGroup="AquariumValidationGroup" onclick="SubmitButton_Click"/>
                </p>
                </div>
            </InsertItemTemplate>
            <ItemTemplate>
                <h1><asp:Label ID="TitleLabel" runat="server" Text="<%# Bind('Title') %>"></asp:Label></h1>

                <div class="liking">
                    <asp:ImageButton ID="ThumbsUpImageButton" runat="server" 
                        ImageUrl="~/Images/thumbsup.gif" AlternateText="I like this" 
                        onclick="ThumbsUpImageButton_Click" Enabled="<%# InsertionPermitted() %>" />
                    <asp:Label ID="LikesLabel" runat="server" Text='<%# Bind("TotalLikes") %>'
                        CssClass="likingLabel"></asp:Label>
                    <asp:ImageButton ID="ThumbsDownImageButton" runat="server" 
                        ImageUrl="~/Images/thumbsdown.gif" AlternateText="I dislike this"
                        onclick="ThumbsDownImageButton_Click" Enabled="<%# InsertionPermitted() %>" />
                    <asp:Label ID="DislikesLabel" runat="server" Text='<%# Bind("TotalDislikes") %>'
                        CssClass="dislikingLabel"></asp:Label>
                </div>

                <p class="author">
                    by
                    <a href="/Pages/MemberDetail.aspx?UserName=<%# Eval("MemberUserName") %>">
                        <asp:Label ID="MemberLabel" runat="server" Text='<%# Bind("MemberFullName") %>' />
                    </a>
                    at
                    <asp:Label ID="CreatedDateLabel" runat="server" Text='<%# Bind("CreatedDateTime", "{0:MMMM d, yyyy}") %>' />
                </p>
                
                <p class="tags">
                    Tags: 
                    <asp:Repeater ID="TagRepeater" runat="server" DataSource='<%# GetAquariumTags(Eval("ID")) %>' Visible="true">
                        <SeparatorTemplate>,</SeparatorTemplate>
                        <ItemTemplate>
                            <asp:HyperLink ID="TagLinkButton" runat="server" Text='<%# Bind("Title") %>'
                                           NavigateUrl='<%# "~/Pages/AquariumList.aspx?Tag=" & Eval("Title") %>' />
                        </ItemTemplate>
                    </asp:Repeater>
                    <asp:Button ID="TagEditLinkButton" runat="server" onclick="TagEditLinkButton_Click"
                                Text="Edit" Visible='<%# InsertionPermitted() %>' Font-Size="X-Small" />
                    <asp:TextBox ID="TagTextBox" runat="server" Text='<%# GetAquariumTagsCSV(Eval("ID")) %>' Visible="false"></asp:TextBox>
                    <asp:Button ID="TagSaveLinkButton" runat="server" Visible="false" onclick="TagSaveLinkButton_Click" Text="Save"/>
                    <asp:Button ID="TagEditCancelLinkButton" runat="server" Visible="false" onclick="TagEditCancelLinkButton_Click" Text="Cancel" />
                </p>

                <asp:Panel ID="ReminderPanel" runat="server" Visible='<%# ShowReminder(Eval("IsDirty")) %>'>
                    <div class="reminder">
                        <asp:Label ID="DirtyAquariumLabel" runat="server"
                            Text="REMINDER: Your aquarium is dirty!"
                             CssClass="reminder"></asp:Label>
                    </div>
                </asp:Panel>

                <p class="textBody">
                    <asp:Image ID="PhotoImage" runat="server"
                               ImageUrl='<%# GetPhotoNormalPath(CULng(Eval("PhotoID"))) %>'
                               AlternateText="<%# Bind('Title') %>"
                               CssClass="centered" />
                </p>

                <p class="textBody">
                    <asp:Label ID="DescriptionLabel" runat="server"
                        Text='<%# Convert.ToString(Eval("Description")).Replace(Environment.NewLine, "<br />") %>' />
                </p>

                <p>
                    <asp:ListView ID="ListGrid" runat="server" GroupItemCount="4"
                        DataSource='<%# GetAquariumFish(Eval("ID")) %>' Visible="true">
                        <EmptyDataTemplate>
                            This aquarium has no fish yet!
                        </EmptyDataTemplate>
                        <GroupTemplate>
                            <tr ID="itemPlaceholderContainer" runat="server">
                                <td ID="itemPlaceholder" runat="server">
                                </td>
                            </tr>
                        </GroupTemplate>
                        <ItemTemplate>
                            <td id="Td1" runat="server">
                                <div class="thumbnail">
                                    <a href='/Pages/FishDetail.aspx?ID=<%# Eval("FishID") %>'>
                                    <asp:Image ID="PhotoImage" runat="server"
                                                ImageUrl='<%# GetPhotoThumbPath(CULng(Eval("PhotoID"))) %>'
                                                AlternateText="<%# Bind('CommonName') %>" />
                                    </a>
                                </div>
                                <div class="caption">
                                    <a href='/Pages/FishDetail.aspx?ID=<%# Eval("FishID") %>'>
                                    <asp:Label ID="TotalLabel" runat="server" Text="<%# Bind('Total') %>" />
                                    <asp:Label ID="TitleLabel" runat="server" Text="<%# Bind('CommonName') %>" /><br />
                                    (<asp:Label ID="ScientificNameLabel" runat="server" Text="<%# Bind('ScientificName') %>" />)
                                    </a>
                                </div>
                            </td>
                        </ItemTemplate>
                        <LayoutTemplate>
                            <h3 class="centered">Contained fish</h3>
                            <table id="Table1" runat="server" class="listView">
                                <tr id="Tr1" runat="server">
                                    <td id="Td2" runat="server">
                                        <table ID="groupPlaceholderContainer" runat="server" border="0">
                                            <tr ID="groupPlaceholder" runat="server">
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr id="Tr2" runat="server">
                                    <td id="Td3" runat="server">
                                    </td>
                                </tr>
                            </table>
                        </LayoutTemplate>
                    </asp:ListView>
                    
                    <p class="submitButton centered">
                        <asp:Button ID="ManageFishButton" runat="server" 
                            Text="Add/remove fish in aquarium" 
                            Visible="<%# ModificationPermitted() %>"
                            onclick="ManageFishButton_Click" />
                    </p>

                    <dl>
                        <dt>Type</dt>
                        <dd>
                            <asp:Label ID="AquTypeLabel" runat="server" 
                                Text='<%# Bind("AquariumType") %>' />
                        </dd>
                        <dt>Temperature</dt>
                        <dd>
                            <asp:Label ID="TemperatureLabel" runat="server" 
                                Text='<%# Bind("Temperature") %>' />
                            °C</dd>
                        <dt>Volume</dt>
                        <dd>
                            <asp:Label ID="VolumeLabel" runat="server" Text='<%# Bind("Volume") %>' />
                            liters</dd>
                        <dt>Product</dt>
                        <dd>
                            <a href='<%# Eval("ProductURL") %>'>
                            <asp:Label ID="ProductLabel" runat="server" Text='<%# Bind("Product") %>' />
                            </a>
                        </dd>
                        <dt>Last Cleaned Date</dt>
                        <dd>
                            <asp:Label ID="LastCleanedDateTimeLabel" runat="server" 
                                Text='<%# Bind("LastCleanedDateTime", "{0:MMMM d, yyyy}") %>' />
                        </dd>
                        <dt>Cleaning period</dt>
                        <dd>
                            Every
                            <asp:Label ID="PeriodDaysCleaningLabel" runat="server" 
                                Text='<%# Bind("PeriodDaysCleaning") %>' />
                            days</dd>
                    </dl>
                  
                    <p class="submitButton">
                        <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" 
                            onclick="DeleteButton_Click" Text="Delete" 
                            Visible="<%# ModificationPermitted() %>" />
                        <asp:Button ID="EditButton" runat="server" CommandName="Edit" 
                            onclick="EditButton_Click" Text="Edit" 
                            Visible="<%# ModificationPermitted() %>" />
                    </p>
                    <h2>
                        Comments</h2>
                    <asp:ListView ID="NestedDetailListView" runat="server">
                        <EmptyDataTemplate>
                            <p>
                                This aquarium has no comments yet!</p>
                        </EmptyDataTemplate>
                        <ItemTemplate>
                            <div class="nestedDetailView">
                                <h3>
                                    <asp:Label ID="TitleLabel" runat="server" Text='<%# Bind("Title") %>' />
                                </h3>
                                <p class="author">
                                    by <a href='/Pages/MemberDetail.aspx?UserName=<%# Eval("MemberUserName") %>'>
                                    <asp:Label ID="MemberLabel" runat="server" 
                                        Text='<%# Bind("MemberFullName") %>' />
                                    </a>at
                                    <asp:Label ID="CreatedDateLabel" runat="server" 
                                        Text='<%# Bind("CreatedDateTime", "{0:MMMM d, yyyy}") %>' />
                                </p>
                                <p class="textBody">
                                    <asp:Label ID="AnswerLabel" runat="server" 
                                        Text='<%# Eval("Description").Replace(Environment.NewLine, "<br />") %>' />
                                </p>
                            </div>
                        </ItemTemplate>
                    </asp:ListView>
                    <asp:Panel ID="CommentPanel" runat="server" 
                        Visible="<%# InsertionPermitted() %>">
                        <div class="itemInfo">
                            <fieldset class="item">
                                <legend>Post your comment</legend><span class="failureNotification">
                                <asp:Literal ID="FailureText" runat="server"></asp:Literal>
                                </span>
                                <asp:ValidationSummary ID="CommentValidationSummary" runat="server" 
                                    CssClass="failureNotification" ValidationGroup="CommentValidationGroup" />
                                <p>
                                    <asp:Label ID="CommentTitleLabel" runat="server" 
                                        AssociatedControlID="CommentTitleTextBox">Title:</asp:Label>
                                    <asp:TextBox ID="CommentTitleTextBox" runat="server" CssClass="textEntry"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="CommentTitleRequiredValidator" runat="server" 
                                        ControlToValidate="CommentTitleTextBox" CssClass="failureNotification" 
                                        ErrorMessage="Title is required." ToolTip="Title is required." 
                                        ValidationGroup="CommentValidationGroup">*</asp:RequiredFieldValidator>
                                </p>
                                <p>
                                    <asp:Label ID="CommentBodyLabel" runat="server" 
                                        AssociatedControlID="CommentBodyTextBox">Comment:</asp:Label>
                                    <asp:TextBox ID="CommentBodyTextBox" runat="server" CssClass="textEntry" 
                                        TextMode="MultiLine"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="CommentBodyRequired" runat="server" 
                                        ControlToValidate="CommentBodyTextBox" CssClass="failureNotification" 
                                        ErrorMessage="Comment is required." ToolTip="Comment is required." 
                                        ValidationGroup="CommentValidationGroup">*</asp:RequiredFieldValidator>
                                </p>
                            </fieldset>
                            <p class="submitButton">
                                <asp:Button ID="SubmitButton" runat="server" CommandName="Submit" 
                                    onclick="SubmitCommentButton_Click" Text="Submit" 
                                    ValidationGroup="CommentValidationGroup" />
                            </p>
                        </div>
                    </asp:Panel>
                    <p>
                    </p>
                    <p>
                    </p>
                </p>

            </ItemTemplate>
        </asp:FormView>
</asp:Content>
